
PROJECT(skeleton_ui)
cmake_minimum_required(VERSION 2.6)

set (arch ${})

message (STATUS "Compiling Skeleton UI sources...")
message (STATUS "Compilers found: ${CMAKE_CXX_COMPILER_LIST}" )
message (STATUS "Using compiler: ${CMAKE_CXX_COMPILER}" )
message (STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
message (STATUS "Arch: ${CMAKE_SYSTEM_PROCESSOR}")

set (CMAKE_CXX_FLAGS "-mmmx -msse -msse2 -save-temps")

SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

set (QT_USE_QTNETWORK true)
set (QT_USE_QTOPENGL true)

find_package ( Qt4 REQUIRED )
find_package(OpenGL REQUIRED)
#find_package(GLUT REQUIRED)
find_package(Lua51 REQUIRED)

include ( ${QT_USE_FILE} )

include_directories(${PROJECT_BINARY_DIR})
include_directories(${PROJECT_SOURCE_DIR})
include_directories(${PROJECT_SOURCE_DIR}/src)
include_directories(${PROJECT_SOURCE_DIR}/src/gui)
include_directories(${PROJECT_SOURCE_DIR}/src/kinect_wrapper)
include_directories(${PROJECT_SOURCE_DIR}/src/pointing_engine)
include_directories(${PROJECT_SOURCE_DIR}/src/shared/math)
include_directories(${PROJECT_SOURCE_DIR}/src/shared/util)

include_directories(${LUA_INCLUDE_DIR})

#set (libs ncurses popt pthread ${GTK2_LIBRARIES} glut ${OPENGL_LIBRARY} ${GLEW_LIBRARY} ${LUA_LIBRARIES})  
set (libs ${QT_LIBRARIES} ${OPENGL_LIBRARY})

set (SHARED_SRCS
  src/shared/math/gvector.h
  src/shared/math/geomalgo.h
  src/shared/math/geometry.h
  src/shared/util/proghelp.cc
  src/shared/util/terminal_utils.cpp
  src/shared/util/configreader.cpp
  src/shared/util/watch_files.cpp
)

set (POINTING_SRCS
  src/pointing_engine/pointing_engine.cpp
  src/kinect_wrapper/kinect_wrapper.cpp
  src/kinect_wrapper/kinect_stubs.cpp
)

set (GUI_SRCS
  src/gui/gui.cpp
)

qt4_wrap_cpp(GUI_MOC_SRCS
  src/gui/gui.h
)

#qt4_add_resources(RC_SRCS 
#  icons/gui_icons.qrc
#  ${SHARED_RC}
#)


#======================================================================================================
#Creating libraries to eliminate redundant compile steps

add_library(shared_libraries ${SHARED_SRCS} ${HW_SRCS} )
target_link_libraries(shared_libraries shared_libraries ${libs})

#======================================================================================================
#The Executable Targets
#
set (target skeleton_pointing)
add_executable(${target} src/gui/skeleton_pointing.cpp ${GUI_MOC_SRCS} ${GUI_SRCS} ${POINTING_SRCS})
add_dependencies(${target} shared_libraries ${GUI_MOC_SRCS})
target_link_libraries(${target} shared_libraries )

